Skip to content

Instantly share code, notes, and snippets.

@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@phuslu
phuslu / cachingmap.go
Last active May 9, 2024 03:50
双缓冲实现无锁map,读取性能和GC友好度最好,一致性较差,写入延迟一般建议设置为分钟级。 https://twitter.com/phuslu/status/1745276311235395708
type CachingMap[K comparable, V any] struct {
// double buffering mechanism
index int64
maps [2]map[K]V
// write queue
queue chan struct {
key K
value V
}
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git

Getting Started with Clojure on Windows

Clojure is an amazingly powerful language. Using it (and watching Rich Hickey videos) has changed the way I think about programming, and the way I code in general. Once I learned the basics of the language, which was a relatively quick process, I fell in love and couldn't look back. I hope this post can help others who are new to Clojure get up and running quickly and painlessly.

This post is opinionated in the sense that I'll suggest certain tools to help those who are new to this scene get on their feet. The things you'll need are:

  • Leiningen (pronounced LINE-ing-en) - This is like a package manager, build tool, task manager, and more in one tool. Think npm or nuget, but with more capabilities. There is at least one other build tool for Clojure (boot), but Leiningen is the most widely used.
  • JDK - Clojure runs on Java. Throw out any qualms you may have about Java, we aren't coding in Java (though we can through Clojure, and sometimes tha
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 9, 2024 03:42
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@hurricane-voronin
hurricane-voronin / README.md
Last active May 9, 2024 03:41
Naming Classes Without a 'Manager'
@s5bug
s5bug / 01a.md
Last active May 9, 2024 03:41
Advent of Code solved in Hex Casting

Accepts input as a list of UTF-32 codepoints and returns a Number.

High-Level

let isNewline: Number -> Boolean =
  (x: Number) -> x == 10

let isDigit: Number -> Boolean =
  (x: Number) -> (x >= 48) && (x < 58)
@s5bug
s5bug / 0_initial_brainstorming.md
Last active May 9, 2024 03:41
Hex Casting compiler ideas

Basic Control Flow

Given an arbitrary program:

@main def lcm(a: Int, b: Int): Int =
  if(a < b) (a * (b / gcd(b, a))
  else (b * (a / gcd(a, b))

def gcd(a: Int, b: Int): Int =
  if(b == 0) a
@Boghdady
Boghdady / eslint-config-airbnb.js
Last active May 9, 2024 03:40
Eslint airbnb configrations for nodejs projects
// 1- Install these packages in your dev dependencies using this command:
npm i -D eslint eslint-config-airbnb eslint-config-prettier eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-node eslint-plugin-prettier eslint-plugin-react prettier
// 2- Create ".eslintrc.json" file in the root directory with these configration:
{
"extends": ["airbnb", "prettier", "plugin:node/recommended"],
"plugins": ["prettier"],
@rickklaasboer
rickklaasboer / how-to-setup-plex-with-sonarr-radarr-jackett-overseerr-and-qbittorrent-using-docker.md
Last active May 9, 2024 03:36
How to setup Plex with Sonarr, Radarr, Jackett, Overseerr and qBitTorrent using Docker

How to setup Plex with Sonarr, Radarr, Jackett, Overseerr and qBitTorrent using Docker

This is a guide that will show you how to setup Plex Media Server with Sonarr, Radarr, Jackett, Overseerr and qBitTorrent with Docker. It is written for Ubuntu 20.04 but should work on other Linux distributions as well (considering supported distributions by Docker). It is also written for people who have some experience with Linux and Docker. If you are new to Docker, I recommend you to read the Docker documentation, and if you are new to Linux, I recommend you to read the Ubuntu documentation.

Now, let's get started!

Please note: This guide was written without considering hardlinking for Sonarr/Radarr. If you want to use hardlinking refer to #Hardlinking

Prerequisites